package com.xb.p34_mvcdemo;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

public class MyView extends View {

    int x,y;


    //上下文，属性集合
    public MyView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    protected void setXY(int _x,int _y){
        x=_x;
        y=_y;
    }
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(Color.CYAN);
        Paint paint=new Paint();

        paint.setAntiAlias(true);//去掉锯齿
        paint.setColor(Color.BLACK);

        canvas.drawCircle(x,y,40,paint);

        paint.setColor(Color.WHITE);
        canvas.drawCircle(x-6,y-6,6,paint);

    }
}
